import { domainService } from '~/config/server';
import { NetService } from '~/utils/net.service';
import { Inject, Debounce } from '~/core/decorator';
export class CaseApplyRecordService {
  @Inject(NetService)
  private netService: NetService;

  /**
   * 获取所有审核记录
   */
  public getAllCaseApplyRecords(data, page, sort) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.getAllCaseApplyRecords,
      data,
      page,
      sort,
    });
  }
  /**
   * 协催申请
   */
  @Debounce()
  public applyCaseAssist(data) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.applyCaseAssist,
      data
    });
  }

  /**
   * 留案申请
   */
  @Debounce()
  public applyLeaveCase(data) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.applyLeaveCase,
      data,
    });
  }
  /**
   * 抢案共享
   */
  @Debounce()
  public applyRobCaseShare(data) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.applyRobCaseShare,
      data,
    });
  }

  /**
   * 抢案申请
   * @param data
   */
  @Debounce()
  public applyRobCase(data) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.applyRobCase,
      data,

    })
  }


  /**
   * 协催留案申请
   */
  @Debounce()
  public applyAssistLeaveCase(data) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.applyAssistLeaveCase,
      data,
    });
  }

  /**
   * 减免申请
   */
  @Debounce()
  public applyDerate(data) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.applyDerate,
      data: {
        applyCategory: data.applyCategory,
        applyDescription: data.applyDescription,
        caseIds: data.caseIds,
        confirm: data.confirm,
        derateInfoRequestList :data.derateInfoRequestList,
        extensionDays :data.extensionDays,
        fileIds: data.fileIds,
        personalName :data.personalName
      },
    });
  }

  /**
   * 留案申请
   */
  @Debounce()
  public dealApply(data) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.dealApply,
      data,
    });
  }

  /**
   * 审批记录
   */
  public recordHistory(data) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.recordHistory,
      data,
    });
  }

  /**
   * 停催申请
   */
  @Debounce()
  public applyPauseCase(data) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.applyPauseCase,
      data,
    });
  }

  /**
   * 提前流转申请
   */
  @Debounce()
  public applyTurnCase(model: any) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.applyTurnCase,
      data: {
        applyCategory: 'TURN_CASE',
        caseIds: model.caseIds,
        turnGoal: model.turnSource,
        applyDescription: model.applyDescription,
        confirm: model.confirm,
      },
    });
  }

  /**
   * 委外回收-申请流转申请
   */
  @Debounce()
  public applyCirculationCase(data) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.applyCirculationCase,
      data,
    });
  }
  /**
   * 人工划扣
   */
  @Debounce()
  public applyRepay(data) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.applyRepay,
      data,
    });
  }

  /**
   * 停催激活
   */
  @Debounce()
  public applyPauseCaseActive(data) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.applyPauseCaseActive,
      data,
    });
  }

  /**
   * 审批类型设置列表
   */
  public checkApplyCategory(data) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.checkApplyCategory,
      data,
    });
  }
  /**
   * 撤回
   */
  public revertVisitAssist(data,scope) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.revertVisitAssist,
      data: {
        caseId: data,
        personalAddressId: scope
      },
    });
  }

  /**
   * 客户标签设置
   * @param data
   */
  public settingPersonalLabel(data:any){
    return this.netService.send({
      server: domainService.caseApplyRecordController.settingPersonalLabel,
      data
    })
  }
  /**
   * 新增修改删除策略
   * @param data
   */
  public approvalStrategyConfig(data:any){
    return this.netService.send({
      server: domainService.caseApplyRecordController.approvalStrategyConfig,
      data
    })
  }
  /**
   * 展期申请
   * @param data
   */
  public applyLoanExtension(data:any){
    return this.netService.send({
      server: domainService.caseApplyRecordController.applyLoanExtension,
      data
    })
  }
  /**
   * 通过applyID获取策略
   * @param data
   */
  public getOneById(id) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.getOneById,
      data:{
        applyId:id
      }
    });
  }
  /**
   * 坏账确认
   * @param data
   */
  public applyVerification(data) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.applyVerification,
      data
    });
  }
  /**
   * 重新提交
   * @param data
   */
  public getVerApplyRecord(data) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.getVerApplyRecord,
      data:{
        verifyBatchNumber:data
      }
    });
  }
  /**
   * 撤销申请
   * @param data
   */
  public approvalWithdraw(data) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.approvalWithdraw,
      data:{
        verifyBatchNumber:data
      }
    });
  }
  /**
   * 我的审核-查看审批历史
   * @param data
   */
  public getCaseApplyInfo(data,page) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.getCaseApplyInfo,
      data:{
        verifyBatchNumber:data
      },
      page
    });
  }
  /**
   * 核销案件查询-查看审批历史
   * @param data
   */
  public getApplyTopInfo(data) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.getApplyTopInfo,
      data:{
        verifyBatchNumber:data
      }
    });
  }
  /**
   * 催收执行页-申请历史撤回
   * @param data
   */
  public approvalDerateWithdraw(data) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.approvalDerateWithdraw,
      data:{
        applyId:data
      }
    });
  }
  /**
   * 统计坏账金额
   * @param data
   */
  public getBadAmount(data) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.getBadAmount,
      data:{
        caseIds:data
      }
    });
  }
  /**
   * 统计案件金额合计
   * @param data
   */
  public getTotalOverdueAmount(data) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.getTotalOverdueAmount,
      data:{
        caseIds:data
      }
    });
  }

  /**
   * 获取坏账金额合计
   * @param data
   */
  public getTotalBadAmount(data) {
    return this.netService.send({
      server: domainService.caseApplyRecordController.getTotalBadAmount,
      data:{
        batchNumber:data
      },
    });
  }
}
